package com.tengju.bff.interfaces.covercharge.util;

import java.math.BigDecimal;

/**
 * @author: 李大仙
 */
public class MoneyUtils {

    /**
     * 计算手续费比率
     *
     * @param money 金额
     */
    public static BigDecimal sumRatio(BigDecimal money) {
        BigDecimal ratio = null;
        if (money.compareTo(MoneyHelper.getInstance().getServiceFeeRatioLimit()) <= 0) {
            if (money.compareTo(BigDecimal.ZERO) == 0) {
                ratio = BigDecimal.ZERO;
            } else {
                ratio = MoneyHelper.getInstance().getServiceFeeRatioSmall();
            }
        } else {
            ratio = MoneyHelper.getInstance().getServiceFeeRatioLarge();
        }
        return ratio.setScale(2, BigDecimal.ROUND_HALF_UP);
    }
}
